<?php

class Publisher {
    private static $listeners = array();

    public static addListener($template, Listener $listener) {
        self::$listeners[$template][] = $listener;
    }

    public static publish($template) {
        foreach (self::$listeners[$template] as $listener) {
            $listern->publish();
        }

    }
}

?>